#include <head.h>

int main(int argc, char const *argv[])
{
    pid_t pid;

    pid = fork();
    if (pid == -1)
    {
        ERRLOG("进程创建失败\n");
    }
    else if(pid > 0)
    {
        printf("我是父进程 我的pid = %d\n",getpid());

        int __stat_loc;
        pid = wait(& __stat_loc);
        printf("子进程结束 %d", pid);

        if (WIFEXITED(__stat_loc))
        {
            printf("返回值的为%d\n",WEXITSTATUS(__stat_loc));
        }
        if (WIFSIGNALED(__stat_loc))
        {
            printf("信号值为%d\n",WTERMSIG(__stat_loc));
        }
        
        
    }
    else if (pid == 0)
    {
        printf("我是子进程 我的pid = %d\n",getpid());
        printf("我是子进程 我的ppid = %d\n",getpid());

        sleep(80);
        printf("我是子进程 我结束了\n");
        exit(10);
    }
    
    
    return 0;
}